<?php
include "./fun.php";
$db=conndb();
$list=get_Children_Class(13,$db);
$sortid=isset($_GET["sortid"])?$_GET["sortid"]:'';
$page=isset($_GET["page"])?$_GET["page"]:1;
$limit=isset($_GET["limit"])?$_GET["limit"]:5;
$keyword=isset($_GET["keyword"])?$_GET["keyword"]:'';
$where='';
if ($sortid) {
    $where.="and sortid='{$sortid}'";
}
if ($keyword) {
    $where.="and solution_name like '%{$keyword}%'";
}
if ($where) {
    $where="where ".substr($where,3);
}
$sql_count="select count(*) as total from solution {$where}";
$re=query1($db,$sql_count,false);
$count=$re["total"];
$start=($page-1)*$limit;
$sql="select * from solution {$where} order by id asc limit {$start},{$limit}";
$res=query1($db,$sql);
$sql_name="select sortname from sortclass where id='{$sortid}'";
$re_name=query1($db,$sql_name,false);
$data=["code"=>0,"msg"=>"操作成功","data"=>$res,"list"=>$list,"page"=>$page,"count"=>$count,"limit"=>$limit,"sortid"=>$sortid,"sortname"=>$re_name["sortname"]];
echo json_encode($data,JSON_UNESCAPED_UNICODE);
?>